package com.panopset.sf.apps.blackjack;

import java.awt.Color;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;

import javax.swing.JLabel;
import javax.swing.JPanel;

import com.panopset.refactorsf.TPanel;
import com.panopset.refactorsf.TitledPanel;

public class CountingStrategy {

    private final BlackjackSwingConfig bsc;

    public CountingStrategy(final BlackjackSwingConfig blackjackSwingConfig) {
        bsc = blackjackSwingConfig;
    }

    private JPanel p;

    public JPanel getPanel() {
        if (p == null) {
            p = new TitledPanel("Card Counting Strategy", new GridBagLayout(), "Configure your card counting strategy for practice and simulations").getPanel();
            GridBagConstraints gbc = new GridBagConstraints();
            p.setName("Card Counting Strategy");
            p.setToolTipText("Card counting strategy");
            gbc.gridx = 0;
            gbc.gridy = 0;
            JPanel p0 = new TPanel();
            p0.add(new JLabel(bsc.getCountingSystemsSelect().getName()));
            p0.add(bsc.getCountingSystemsSelect());
            p.add(p0, gbc);
            gbc.fill = GridBagConstraints.HORIZONTAL;
            gbc.gridy++;
            gbc.weightx = 1.0;
            gbc.gridwidth = 2;
            p.add(bsc.getBetStrategyTF().getPanel(), gbc);
            gbc.gridy++;
            p.add(bsc.getBetStrategyNegativeCountTF().getPanel(), gbc);
            gbc.gridy++;
            p.add(bsc.getLargeBetTF().getPanel(), gbc);
            gbc.gridy++;
            gbc.weighty = 1.0;
            p.add(bsc.getTargetStakeTF().getPanel(), gbc);
        }
        return p;
    }

}
